/*
 * @Description: 
 * @Author: shuliang
 * @Date: 2022-05-11 14:29:44
 * @LastEditTime: 2022-05-11 14:30:37
 * @LastEditors: shuliang
 */
import { AxiosRequestConfig, CustomSuccessData } from 'axios'
import service from './request'
interface IAxiosGet {
    <T = any>(url: string, params?: Record<string, any>, config?: AxiosRequestConfig | null ) : Promise<CustomSuccessData<T>>
}
interface IAxiosPostOrPutOrDelete {
    <T = any>(url: string, data?: Record<string, any>, config?: AxiosRequestConfig ) : Promise<CustomSuccessData<T>>
}
const get:IAxiosGet = (url, params, config) => {
    return service.get(url,{params, ...config})
}
const post:IAxiosPostOrPutOrDelete = (url, data, config) => {
    return service.post(url, data, config)
}
const put:IAxiosPostOrPutOrDelete = (url, data, config) => {
    return service.put(url, data, config)
}
const deleteRequest:IAxiosPostOrPutOrDelete = (url, data, config) => {
    return service.delete(url,{data, ...config})
}
export default {
    get,
    post,
    put,
    "delete":deleteRequest
}